import { TweenPlugin } from "./TweenPlugin";
import { TweenLite } from "../TweenLite";
type int = number;
//class EndArrayPlugin
    
    export  class EndArrayPlugin extends TweenPlugin
    {
        constructor()
        {
            
            this._info = [];
            this.propName = "endArray";
            this.overwriteProps = ["endArray"];
            return;
        }

        public /* override */ onInitTween(arg1: Object, arg2, arg3: TweenLite): Boolean
        {
            if (typeof !(arg1 === "array") || !(arg2 is Array)) 
            {
                return false;
            }
            this.init(arg1 as Array<any>, arg2);
            return true;
        }

        public init(arg1: Array<any>, arg2: Array<any>): void
        {
            this._a = arg1;
            var loc1=arg2.length;
            while (loc1--) 
            {
                if (!(!(arg1[loc1] == arg2[loc1]) && !(arg1[loc1] == null))) 
                {
                    continue;
                }
                this._info[this._info.length] = new ArrayTweenInfo(loc1, this._a[loc1], arg2[loc1] - this._a[loc1]);
            }
            return;
        }

        public /* override */ set changeFactor(arg1: number)
        {
            var loc2=null;
            var loc3=NaN;
            var loc1=this._info.length;
            if (this.round) 
            {
                while (loc1--) 
                {
                    loc2 = this._info[loc1];
                    loc3 = loc2.start + loc2.change * arg1;
                    this._a[loc2.index] = loc3 > 0 ? int(loc3 + 0.5) : int(loc3 - 0.5);
                }
            }
            else 
            {
                while (loc1--) 
                {
                    loc2 = this._info[loc1];
                    this._a[loc2.index] = loc2.start + loc2.change * arg1;
                }
            }
            return;
        }

        public static /* const */API: number=1;

        protected /* var */_a: Array<any>;

        protected /* var */_info: Array<any>;
    }
}


class ArrayTweenInfo
{
    public ArrayTweenInfo(arg1: uint, arg2: number, arg3: number)
    {
        super();
        this.index = arg1;
        this.start = arg2;
        this.change = arg3;
        return;
    }

    public /* var */index: uint;

    public /* var */start: number;

    public /* var */change: number;
